//
//  PostMessageDataBase.h
//  SIPphone
//
//  Created by wrt on 13-12-16.
//  Copyright (c) 2013年 wrtsoft. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <sqlite3.h>

//SQLITE所需要的字符串 宏定义方便调用以及避免字符出错
#define POSTTABLE_NAME @"postmsg"
#define POST_TIME @"postTime"
#define POST_PATH @"postPath"
#define POST_KIND @"postKind"
#define POST_NOTICE @"postnotice"
#define POST_TEXT @"posttext"
#define POST_STATUS @"poststatus"

@interface PostMessageDataBase : NSObject
{
    sqlite3 *db;  //SQLite3数据库
}


//从数据库获取出来的时间
@property (nonatomic, strong) NSString *tempTime;
//从数据库获取出来的文本
@property (nonatomic, strong) NSString *tempText;
//从数据库获取出来的状态
@property (nonatomic, strong) NSString *tempStatus;
//从数据库获取出来的URL地址
@property (nonatomic, strong) NSString *tempUrlPath;
//从数据库获取出来的是否是通知消息
@property (nonatomic, strong) NSString *tempNotice;
//从数据库获取出来的消息种类
@property (nonatomic, strong) NSString *tempKind;


//时间数组
@property (nonatomic, strong) NSMutableArray *timeArray;
//文本数组
@property (nonatomic, strong) NSMutableArray *textArray;
//状态数组
@property (nonatomic, strong) NSMutableArray *statusArray;
//地址数组
@property (nonatomic, strong) NSMutableArray *pathArray;
//通知数组
@property (nonatomic, strong) NSMutableArray *noticeArray;
//消息种类数组
@property (nonatomic, strong) NSMutableArray *kindArray;

//用于分页查询
//时间数组
@property (nonatomic, strong) NSMutableArray *partTimeArray;
//文本数组
@property (nonatomic, strong) NSMutableArray *partTextArray;
//状态数组
@property (nonatomic, strong) NSMutableArray *partStatusArray;
//地址数组
@property (nonatomic, strong) NSMutableArray *partPathArray;
//通知数组
@property (nonatomic, strong) NSMutableArray *partNoticeArray;
//消息种类数组
@property (nonatomic, strong) NSMutableArray *partKindArray;

//定义表名的属性
@property (strong, nonatomic) NSString *tableNameForUser;


//单例的初始化方法
+ (PostMessageDataBase *)sharePostMessageDateBase;
//创建数据库
- (void)createDb;
//读取数据库中的数值
- (void)loadArray;
//写进数据库
- (void)savePostMsg:(NSString *)time andKind:(NSString *)kind andNotice:(NSString *)notice andPath:(NSString *)path andText:(NSString *)text;
//修改数据库未读状态的方法
- (void)editStatusWithTime:(NSString *)time andText:(NSString *)text;
//删除单条数据库
- (void)deleteWithTime:(NSString *)time andText:(NSString *)text;
//删除全部
- (void)removeAll;
//获取未读的条数
- (int)countForUnreadWith;
//获取部分信息15一组
- (void)readDBForpartWithBeginNumber:(int)begin;

//切换表名
- (void)changeTableName:(NSString *)userName;
@end
